package cn.xinfei.xdecision.common.service.monitor.decisionflow.impl;

import cn.xinfei.xdecision.common.dao.enginex.EngineResultSetMapper;
//import cn.xinfei.xdecision.common.dao.monitor.decisionflow.MonitorDecisionFlowHbaseMapper;
//import cn.xinfei.xdecision.common.dao.monitor.decisionflow.MonitorNodeHbaseMapper;
//import cn.xinfei.xdecision.common.dao.monitor.decisionflow.MonitorStrategyHbaseMapper;
import cn.xinfei.xdecision.common.model.enginex.po.EngineResultSet;
import cn.xinfei.xdecision.common.model.monitor.decisionflow.DecisionFlowRequestDTO;
import cn.xinfei.xdecision.common.service.monitor.decisionflow.IMonitorService;
import cn.xinfei.xdecision.common.utils.constant.monitor.MonitorStorageType;
//import com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate;
//import org.apache.hadoop.hbase.client.Scan;
//import org.apache.hadoop.hbase.util.Bytes;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;

@Service("monitorServiceImpl")
@Slf4j
public class MonitorServiceImpl implements IMonitorService {

//    @Autowired
//    public HbaseTemplate hbaseTemplate;
    @Resource
    public EngineResultSetMapper resultSetMapper;

    @Override
    public String getStorageType() {
        return MonitorStorageType.HBase;
    }

    @Override
    public List<EngineResultSet> getEngineResultSetBySegment(Map map) {
        return resultSetMapper.getEngineResultSetBySegment(map);
    }

    @Override
    public List<?> getResultDecisionFlowDetail(DecisionFlowRequestDTO param) {
//        Scan scan = new Scan(Bytes.toBytes(param.getHbaseRowKey()),Bytes.toBytes(param.getHbaseRowKey()));
//        //根据条件查询Hbase表中信息。
//        List<MonitorDecisionFlow> monitorDecisionFlows = hbaseTemplate.find(
//                Constants.MonitorDecisionFlow.TABLE_NAME,
//                scan, new MonitorDecisionFlowHbaseMapper());
//        return monitorDecisionFlows;
        return null;
    }

    @Override
    public List<?> getResultNodeDetail(DecisionFlowRequestDTO param) {
//        Scan scan = new Scan(Bytes.toBytes(param.getHbaseRowKey()),Bytes.toBytes(param.getHbaseRowKey()));
//        Scan scan = new Scan();
//        //根绝条件查询Hbase表中信息
//        List<MonitorNode> monitorNodes = hbaseTemplate.find(
//                Constants.MonitorNode.TABLE_NAME,
//                scan,new MonitorNodeHbaseMapper());
//        return monitorNodes;
        return null;
    }

    @Override
    public List<?> getResultStrategyDetail(DecisionFlowRequestDTO param) {
//        Scan scan = new Scan(Bytes.toBytes(param.getHbaseRowKey()),Bytes.toBytes(param.getHbaseRowKey()));
////        Scan scan = new Scan();
//        //根绝条件查询Hbase表中信息
//        List<MonitorStrategy> monitorStrategies = hbaseTemplate.find(
//                Constants.MonitorStrategy.TABLE_NAME,
//                scan,new MonitorStrategyHbaseMapper());
//        //返回
//
//        return monitorStrategies;
        return null;
    }

}
